package TestSort;

public class BubbleSort {
    public static void bubbleSort (int[] arr) {
        for (int i = 0; i < arr.length; i++) {
             boolean flg = true;
            for (int j = i; j < arr.length; j++) {
                if (arr[i] > arr[j]) {
                    swap(arr, i, j);
                    flg = false;
                }
            }
            if (flg) {
                break;
            }
        }

    }

    public static void swap (int[] arr, int a, int b) {
        int tmp = arr[a];
        arr[a] = arr[b];
        arr[b] = tmp;
    }
}
